package com.zy.openchat.core.model.group;

import android.app.Activity;
import android.content.Intent;

import com.zy.openchat.core.manager.TelegramManager;

import java.io.Serializable;

public class LocalMessageInfo implements Serializable {

    public TelegramManager.MessageType messageType;
    public String content;
    public int countDown;
    public int width;
    public int height;
    public long duration;
    public long date;


    public static LocalMessageInfo buildTextLocalMessage(String text,int countDown){
        LocalMessageInfo messageInfo = new LocalMessageInfo();
        messageInfo.messageType = TelegramManager.MessageType.MessageType_Text;
        messageInfo.content = text;
        messageInfo.countDown = countDown;
        messageInfo.date = System.currentTimeMillis();
        return messageInfo;
    }

    public static LocalMessageInfo buildMediaLocalMessage(TelegramManager.MessageType messageType,String path,int countDown,int width,int height,long duration){
        LocalMessageInfo messageInfo = new LocalMessageInfo();
        messageInfo.messageType = messageType;
        messageInfo.content = path;
        messageInfo.width = width;
        messageInfo.height = height;
        messageInfo.duration = duration;
        messageInfo.countDown = countDown;
        messageInfo.date = System.currentTimeMillis();
        return messageInfo;
    }

    public static void setResultIntent(Activity activity,GroupSendInfo groupSendInfo,LocalMessageInfo messageInfo){
        Intent intent = new Intent();
        intent.putExtra("message", messageInfo);
        intent.putExtra("groupsend",groupSendInfo);
        activity.setResult(Activity.RESULT_OK,intent);
        activity.finish();
    }

}
